home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD ROM Paradise Collection 4
/
CD ROM Paradise Collection 4 1995 Nov.iso
/
program
/
pcfig4th.zip
/
EDITOR.SCR
< prev
next >
Wrap
Text File
|
1985-04-23
|
7KB
|
1 lines
FORTH, Inc. editor From Forth Dimensions, 3:80 editor loading, please wait... ( "Starting Forth" line editor - load screen ) FORTH DEFINITIONS HEX : TEXT HERE C/L 1+ BLANKS WORD HERE PAD C/L 1+ CMOVE ; : LINE DUP 0FFF0 AND IF 17 MESSAGE DROP QUIT ENDIF SCR @ (LINE) DROP ; VOCABULARY EDITOR IMMEDIATE HEX : WHERE DUP B/SCR / DUP SCR ! ." Scr " DECIMAL . SWAP C/L /MOD C/L * ROT BLOCK + CR C/L TYPE CR HERE C@ - SPACES 5E EMIT [COMPILE] EDITOR QUIT ; --> ( S.F. editor definitions ) EDITOR DEFINITIONS : #LOCATE R# @ C/L /MOD ; : #LEAD #LOCATE LINE SWAP ; : #LAG #LEAD DUP >R + C/L R> - ; : -MOVE LINE C/L CMOVE UPDATE ; : BUF-MOVE PAD 1+ C@ IF PAD SWAP C/L 1+ CMOVE ELSE DROP ENDIF ; : >LINE# #LOCATE SWAP DROP ; : FIND-BUF PAD 50 + ; : INSERT-BUF FIND-BUF 50 + ; : (HOLD) LINE INSERT-BUF 1+ C/L DUP INSERT-BUF C! CMOVE ; : (KILL) LINE C/L BLANKS UPDATE ; : (SPREAD) >LINE# DUP 1 - 0E DO I LINE I 1+ -MOVE -1 +LOOP (KILL) ; --> ( S.F. editor definitions, cont. ) : DISPLAY-CURSOR CR SPACE #LEAD TYPE 05E EMIT #LAG TYPE #LOCATE . DROP ; : (TOP) 0 R# ! ; : SEEK-ERROR (TOP) FIND-BUF HERE C/L 1+ CMOVE HERE ." couldn't find " COUNT TYPE QUIT ; : X >LINE# DUP (HOLD) 0F DUP ROT DO I 1+ LINE I -MOVE LOOP (KILL) ; : T C/L * R# ! 0 DISPLAY-CURSOR ; : L SCR @ LIST ; : N 1 SCR +! ; : B -1 SCR +! ; : (R) >LINE# INSERT-BUF 1+ SWAP -MOVE ; : P 5E TEXT INSERT-BUF BUF-MOVE (R) ; --> ( S.F. editor definitions, cont. ) : WIPE 10 0 DO I (KILL) LOOP ; : COPY B/SCR * OFFSET @ + SWAP B/SCR * B/SCR OVER + SWAP DO DUP FORTH I BLOCK 2 - ! 1+ UPDATE LOOP DROP FLUSH ; : 1LINE #LAG FIND-BUF COUNT MATCH R# +! ; : (SEEK) BEGIN 3FF R# @ < IF SEEK-ERROR ENDIF 1LINE UNTIL ; : (DELETE) >R #LAG + R - #LAG R MINUS R# +! #LEAD + SWAP CMOVE R> BLANKS UPDATE ; : (F) 5E TEXT FIND-BUF BUF-MOVE (SEEK) ; : F (F) DISPLAY-CURSOR ; : (E) FIND-BUF C@ (DELETE) ; : E (E) DISPLAY-CURSOR ; : D (F) E ; --> ( S.F. editor definitions, cont. ) 0 VARIABLE COUNTER : TILL #LEAD + 5E TEXT FIND-BUF BUF-MOVE 1LINE 0= IF SEEK-ERROR ENDIF #LEAD + SWAP - (DELETE) DISPLAY-CURSOR ; : BUMP 1 COUNTER +! COUNTER @ 38 > IF 0 COUNTER ! CR CR 0F MESSAGE 0C EMIT ENDIF ; : S 0C EMIT 5E TEXT 0 COUNTER ! FIND-BUF BUF-MOVE SCR @ DUP >R DO I SCR ! (TOP) BEGIN 1LINE IF DISPLAY-CURSOR SCR ? BUMP ENDIF 3FF R# @ < UNTIL LOOP R> SCR ! ; --> ( S.F. editor definitions, cont. ) : I 5E TEXT INSERT-BUF BUF-MOVE INSERT-BUF COUNT #LAG ROT OVER MIN >R R R# +! R - >R DUP HERE R CMOVE HERE #LEAD + R> CMOVE R> CMOVE UPDATE DISPLAY-CURSOR ; : U C/L R# +! (SPREAD) P ; : R (E) I ; : M SCR @ >R R# @ >R >LINE# (HOLD) SWAP SCR ! 1+ C/L * R# ! (SPREAD) (R) R> C/L + R# ! R> SCR ! ; : t T ; : l L ; : n N ; : b B ; : p P ; : f F ; : s S ; : i I ; : u U ; : r R ; FORTH DEFINITIONS DECIMAL CR CR ." Current screen is " SCR ? ;S